import 'package:word_game/engine/core.dart';

class Gate extends Scene with Openable {
  Gate(Map map) : super(map) {
    add(OpenEvent());
  }
  
  @override
  bool open() {
    bool haveKey = World.instance.hero.bag.things.where((test)=>test.code=='gate_key').toList().length>0;
    if (!haveKey) {
      Engine.instance.displayer.displayString('你没有铁门钥匙，无法开门。');
      return false;
    }
    Engine.instance.displayer.displayString('后山铁门被打开，老爷爷的孙女得救了。');
    return true;
  }
}